<!DOCTYPE html>
<html>
<head>
	<title>订单列表</title>
	<meta charset="utf-8">
	<link rel="stylesheet" type="text/css" href="./static/bootstrap/css/bootstrap.min.css">
	<script type="text/javascript" src="./static/jquery-2.0.3.min.js"></script>
	<script type="text/javascript" src="./static/vue.js"></script>

	<script type="text/javascript" src="./static/bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="./static/jquery.cookie.js"></script>
</head>

<body>
<div class="container" id="app">
	<h1 class="sub-header">订单列表</h1>
	<div class="panel panel-default">
		<div class="panel-body">
            <button v-on:click="addorder" class="btn btn-success">添加订单</button>
			<input type="text" v-model="keyword">
			<button v-on:click="getlog">搜索</button>
		</div>
	</div>
	<div class="table-responsive">
		<table class="table table-bordered">
			<thead class="">
                <tr class="active">
                    <th>产品大号</th>
                    <th>经销商</th>
                    <th>客户地址</th>
                    <th>程数/总包</th>
                    <th>安装人员</th>
                    <th>预约安装时间</th>
                    <th>收费金额</th>
                    <th>安装费</th>
                    <th>验收情况</th>
                    <th>厂装/店装</th>
                    <th>近郊/远郊</th>
                    <th>每日完成量</th>
                    <th>日期</th>
                    <th>回访满意度</th>
                    <th>不满意原因</th>
                    <th>反馈信息</th>
                    <th>备注</th>
                    <th>操作</th>
                </tr>
			</thead>
			<tr class="active" v-for="order in orderList">
				<td><a href='/infopage?id=' >{{order.id}}</a></td>
				<td>{{order.broker}}</td>
				<td>{{order.address}}</td>
				<td>{{order.pattern}}</td>
				<td>{{order.operator}}</td>
				<td>{{order.booking.String}}</td>
				<td>{{order.price}}</td>
				<td>{{order.fee}}</td>
				<td>{{order.validate}}</td>
				<td>{{order.diy_type}}</td>
				<td>{{order.suburb}}</td>
				<td>{{order.degree}}</td>
				<td>{{order.dateline.String}}</td>
				<td>{{order.satisfied}}</td>
				<td>{{order.reason}}</td>
				<td>{{order.feedback}}</td>
				<td>{{order.desc}}</td>
                <td>
                	<a href='/savepage?id=' class="btn btn-info">编辑</a>
                	<a href='/delorder?id=' class="btn btn-danger">删除</a>
                </td>
			</tr>
		</table>
	</div>
</div>
</body>
<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            orderList: [],
            keyword: ''
        },
        methods:{
            //获取日志列表
            getlog:function (event) {
                var _that = this;

                $.get("/getlist", {keyword:_that.keyword}, function (result) {
                    if(result.errcode == 0){
                    	console.log("ddd");
                        _that.orderList = result.data;
                    }
                });
            },

            // 添加订单
            addorder:function (event){
                window.location.href = "/savepage";
            }
        }
    });

    //初始化页面数据
    app.getlog();
</script>
</html>